// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import VueRouter from 'vue-router'
import VueSource from 'vue-resource'
import App from './App'

import './common/stylus/index.styl'

// 引入路由组件
import Goods from './components/goods/goods.vue'
import Ratings from './components/ratings/ratings.vue'
import Sellers from './components/sellers/sellers.vue'

Vue.use(VueRouter)
Vue.use(VueSource)
Vue.config.productionTip = false

// 定义路由
const routes = [
  {path: '/goods', component: Goods},
  {path: '/ratings', component: Ratings},
  {path: '/sellers', component: Sellers},
  {path: '/', redirect: '/goods'}
]

// 创建router实例
const router = new VueRouter({
  routes,
  linkActiveClass: 'active'
})

/* eslint-disable no-new */
new Vue({
  el: '#app',
  template: '<App/>',
  router,
  components: { App }
})
